package com.Serverce;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;

import com.Client.CheckThread;
import com.thread.TimeCheckThread;



public class startSever {
	private static final Logger _log = Logger.getLogger(startSever.class.getName());
	private static final String LOG_PROP = "./config/log.properties";
	    
	public static void main(String[] args) throws IOException, SQLException {
		final File logFolder = new File("log");
		logFolder.mkdir();
		try {
			final InputStream is = new BufferedInputStream(new FileInputStream(LOG_PROP));
			LogManager.getLogManager().readConfiguration(is);
			is.close();
		} catch (final IOException e) {
			_log.log(Level.SEVERE, "Failed to Load " + LOG_PROP + " File.", e);
			System.exit(0);
		}
//		URL url = new URL("https://dl.dropboxusercontent.com/u/61561180/ServerIp.ini");
//		 InputStream src = null;
//		src = url.openStream();
//		BufferedReader br = new BufferedReader(new InputStreamReader(src)); 
//		SERVER_IP =br.readLine();
//		SERVER_PORT = Integer.valueOf(br.readLine());
		Config.load();
//		DatabaseFactoryLogin.setDatabaseSettings();
//		DatabaseFactoryLogin.get();
//		BanIpTable.getInstance().getIpTable();
//		OkIpTable.get().getIpTable();
		System.out.println("等候開始連接命令...!!!");
		// 監聽端口啟動重置作業
		new TimeCheckThread().start();
		EchoServerTimer.get().start();
		new CheckThread().start();
	}
}
